Global $ans, $cnt, $def, $inifle, $text
$ans = MsgBox(262179, "Add Tab Query", "Process starts from currently selected line." & Chr(13) & "YES = Process all lines until 'EndFunc'" & Chr(13) & "NO = Only process current line" & Chr(13) & "CANCEL = Abort process")
If $ans > 2 Then
$inifle = @ScriptDir & "\Settings.ini"
$def = IniRead($inifle, "Title", "part", "")
AutoItSetOption("WinTitleMatchMode", 2)
WinActivate($def, "")
While 1
Send("+{RIGHT}")
Send("^c")
$text = ClipGet()
Send("{LEFT}")
If $text = @TAB Or $text = ";" Then
Send("{TAB}")
Send("+{HOME}")
Send("{LEFT}")
Send("{DOWN}")
ElseIf $text = " " Or $text = Chr(13) Or $text = Chr(9) Or $text = Chr(8) Then
Send("{TAB}")
Send("+{HOME}")
Send("{LEFT}")
Send("{DOWN}")
ExitLoop
Else
Send("+{RIGHT 7}")
Send("^c")
$text = ClipGet()
If $text = "EndFunc" Then
Send("{LEFT}")
ExitLoop
Else
Send("{LEFT}")
Send("{TAB}")
Send("+{HOME}")
Send("{LEFT}")
Send("{DOWN}")
EndIf
EndIf
If $ans = 7 Then
$ans = MsgBox(262177, "Add Tab Query", "OK = Next line" & Chr(13) & "CANCEL = Abort")
If $ans = 1 Then
$ans = 7
ElseIf $ans = 2 Then
ExitLoop
EndIf
EndIf
WEnd
If $ans = 6 Then MsgBox(64, "Tab Result", "If happy with results, then Save the script, else use SciTE's Revert option.")
EndIf
Exit





NEW VARIATION (Exit the Func option at a Case statement)
=============

Global $ans, $cnt, $def, $inifle, $text
$ans = MsgBox(262179, "Add Tab Query", "Process starts from currently selected line." & Chr(13) & "YES = Process all lines until 'EndFunc'" & Chr(13) & "NO = Only process current line" & Chr(13) & "CANCEL = Abort process" & Chr(13) & Chr(13) & "NOTE - Option to exit when at a Case line.")
If $ans > 2 Then
$inifle = @ScriptDir & "\Settings.ini"
$def = IniRead($inifle, "Title", "part", "")
AutoItSetOption("WinTitleMatchMode", 2)
WinActivate($def, "")
While 1
Send("+{RIGHT}")
Send("^c")
$text = ClipGet()
Send("{LEFT}")
If $text = @TAB Or $text = ";" Then
Send("+{END}")
Send("^c")
$text = ClipGet()
Send("{LEFT}")
If StringInStr($text, "Case $msg") > 0 Then
$ans = MsgBox(262177, "Case Line Found", "OK = Continue" & Chr(13) & "CANCEL = Abort")
If $ans = 2 Then
ExitLoop
Else
Send("{TAB}")
Send("+{HOME}")
Send("{LEFT}")
Send("{DOWN}")
EndIf
Else
Send("{TAB}")
Send("+{HOME}")
Send("{LEFT}")
Send("{DOWN}")
EndIf
ElseIf $text = " " Or $text = Chr(13) Or $text = Chr(9) Or $text = Chr(8) Then
Send("{TAB}")
Send("+{HOME}")
Send("{LEFT}")
Send("{DOWN}")
ExitLoop
Else
Send("+{RIGHT 7}")
Send("^c")
$text = ClipGet()
If $text = "EndFunc" Then
Send("{LEFT}")
ExitLoop
Else
Send("{LEFT}")
Send("{TAB}")
Send("+{HOME}")
Send("{LEFT}")
Send("{DOWN}")
EndIf
EndIf
If $ans = 7 Then
$ans = MsgBox(262177, "Add Tab Query", "OK = Next line" & Chr(13) & "CANCEL = Abort")
If $ans = 1 Then
$ans = 7
ElseIf $ans = 2 Then
ExitLoop
EndIf
EndIf
WEnd
If $ans = 6 Then MsgBox(64, "Tab Result", "If happy with results, then Save the script, else use SciTE's Revert option.")
EndIf
Exit
